***Curtis RESTAT
***This do file runs the regressions found in Table A2
**Change to directory where data and code were downloaded
**cd 

use pricereg_tableA2.dta, clear

so year
merge m:1 year using tempinf_tableA2
drop _m
drop if inlist(year,2009,2010)
drop if inlist(state,"11","29") /*Drops DC and MO which are not included in the main analysis*/
so state year
merge 1:1 state year using empweight_tableA2.dta
gen emp98t=emp if year==1998
egen emp98=max(emp98t),by(state)
replace lindprice=ln(ind_price/base)
replace lindprice=ln(ind_price)
replace east=1 if inlist(statename,"IA","MN","WI","ND","ME","VT","NH")
drop if statename=="DC"
replace postxeast=post*east
qui areg lind postxeast percoalxcoalprice peroilxoilprice pernatgasxnatgasprice yr*,abs(state) cl(state)
gen trend=year-1997
gen easttrend=east*trend
gen westtrend=((east-1)^2)*trend
gen trendposteast=easttrend*post


areg lind postxeast percoalxcoalprice peroilxoilprice pernatgasxnatgasprice post east/*[aweight=emp98]*/, abs(state) cl(state) 
est store PE1
areg lind postxeast percoalxcoalprice peroilxoilprice pernatgasxnatgasprice yr*/*[aweight=emp98]*/,abs(state) cl(state)
est store PE2
areg lind postxeast easttrend westtrend percoalxcoalprice peroilxoilprice pernatgasxnatgasprice yr*/*[aweight=emp98]*/,abs(state) cl(state)
est store PE3
outreg2 [PE1 PE2 PE3] using elec.doc,drop(yr* easttrend westtrend) addtext(State FE, YES, Year FE, YES, East/West Trends, YES) nocons replace





